home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
netz
/
term
/
extras
/
source
/
gtlayout-source.lha
/
LTP_RenderCircle.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-13
|
1KB
|
68 lines
/* GadTools layout toolkit
**
** Copyright © 1993-1995 by Olaf `Olsen' Barthel
** Freely distributable.
*/
#include "gtlayout_global.h"
#ifdef DO_TAPEDECK_KIND
VOID __regargs
LTP_RenderCircle(struct RastPort *RPort,LONG Left,LONG Top,LONG Radius,LONG AspectX,LONG AspectY)
{
LONG x = 0,y = Radius,Delta = 2 * (1 - Radius),delta,Limit = 0,Length;
while(y >= Limit)
{
if(Delta < 0)
{
delta = 2 * Delta + 2 * y - 1;
if(delta > 0)
{
x = x + 1;
y = y - 1;
Delta = Delta + 2 * x - 2 * y + 2;
}
else
{
x = x + 1;
Delta = Delta + 2 * x + 1;
}
}
else
{
if(Delta > 0)
{
delta = 2 * Delta - 2 * x - 1;
if(delta > 0)
{
y = y - 1;
Delta = Delta - 2 * y + 1;
}
else
{
x = x + 1;
y = y - 1;
Delta = Delta + 2 * x - 2 * y + 2;
}
}
else
{
x = x + 1;
y = y - 1;
Delta = Delta + 2 * x - 2 * y + 2;
}
}
Length = (x * AspectY) / AspectX;
Move(RPort,Left - Length,Top + y - 1);
Draw(RPort,Left + Length - 1,Top + y - 1);
Move(RPort,Left - Length,Top - y);
Draw(RPort,Left + Length - 1,Top - y);
}
}
#endif /* DO_TAPEDECK_KIND */